//
//  ImageViewCollectionCell.m
//  ArtDog
//
//  Created by dllo on 16/9/5.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ImageViewCollectionCell.h"
#import "CommunityPicture.h"
#import "UIImageView+WebCache.h"

@interface ImageViewCollectionCell ()<UIGestureRecognizerDelegate>


@end

@implementation ImageViewCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setImage:(NSString *)image
{
    _image = image;
    _imageView.image = [UIImage imageNamed:image];
}

- (void)prepareForReuse
{
    [super prepareForReuse];
    _selectView.hidden = YES;
}

- (void)setUrlImage:(NSString *)urlImage
{
    _urlImage = urlImage;
    NSString *urlString = [urlImage stringByAppendingString:[NSString stringWithFormat:@"?imageMogr/thumbnail/%dx%d", (int)self.frame.size.width * 2, (int)self.frame.size.height * 2]];
    [_imageView sd_setImageWithURL:[NSURL URLWithString:urlString] placeholderImage:[UIImage imageNamed:@"placeholder"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        
    }];
    //_imageView.image = [UIImage imageNamed:@"placeholder"];
    
}

- (void)setPictureModel:(CommunityPicture *)pictureModel
{
    _pictureModel = pictureModel;
    NSString *appendingString = [NSString stringWithFormat:@"?imageMogr/thumbnail/%dx%d", (int)self.frame.size.width * 2, (int)self.frame.size.height * 2];
    [_imageView sd_setImageWithURL:[NSURL URLWithString:[pictureModel.picPath stringByAppendingString:appendingString]] placeholderImage:[UIImage imageNamed:@"placeholder"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    }];
    
   
    //_imageView.image = [UIImage imageNamed:@"placeholder"];
}


@end
